// pages/classify/classify.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    cateItems: [
      {
        cate_id: 1,
        cate_name: "家用电器",
        ishaveChild: true,
        children:
          [
            {
              child_id: 1,
              name: '洁面皂',
              image: "./img/666.png"
            },
            {
              child_id: 2,
              name: '卸妆',
              image: "./img/666.png"
            },
            {
              child_id: 3,
              name: '洁面乳',
              image: "./img/666.png"
            },
            {
              child_id: 4,
              name: '面部祛角质',
              image: "./img/666.png"
            }
          ]
      },
      {
        cate_id: 2,
        cate_name: "家居百货",
        ishaveChild: true,
        children:
          [
            {
              child_id: 1,
              name: '气垫bb',
              image: "./img/666.png"
            },
            {
              child_id: 2,
              name: '修容/高光',
              image: "./img/666.png"
            },
            {
              child_id: 3,
              name: '遮瑕',
              image: "./img/666.png"
            },
            {
              child_id: 4,
              name: '腮红',
              image: "./img/666.png"
            },
            {
              child_id: 5,
              name: '粉饼',
              image: "./img/666.png"
            },
            {
              child_id: 6,
              name: '粉底',
              image: "./img/666.png"
            },
            {
              child_id: 7,
              name: '蜜粉/散粉',
              image: "./img/666.png"
            },
            {
              child_id: 8,
              name: '隔离霜',
              image: "./img/666.png"
            },
            {
              child_id: 9,
              name: '蜜粉/散粉',
              image: "./img/666.png"
            },
            {
              child_id: 10,
              name: '隔离霜',
              image: "./img/666.png"
            }
          ]
      },
      {
        cate_id: 3,
        cate_name: "美妆个护",
        ishaveChild: true,
        children:
          [
            {
              child_id: 1,
              name: '淡香水EDT',
              image: "./img/666.png"
            },
            {
              child_id: 2,
              name: '浓香水EDP',
              image: "./img/666.png"
            },
            {
              child_id: 3,
              name: '香体走珠',
              image: "./img/666.png"
            },
            {
              child_id: 4,
              name: '古龙香水男士的最爱',
              image: "./img/666.png"
            }
          ]
      },
      {
        cate_id: 4,
        cate_name: "箱包配饰",
        ishaveChild: true,
        children:
          [
            {
              child_id: 1,
              name: '淡香水EDT',
              image: "./img/666.png"
            },
            {
              child_id: 2,
              name: '浓香水EDP',
              image: "./img/666.png"
            },
            {
              child_id: 3,
              name: '香体走珠',
              image: "./img/666.png"
            },
            {
              child_id: 4,
              name: '古龙香水男士的最爱',
              image: "./img/666.png"
            }
          ]
      },      
      {
        cate_id: 5,
        cate_name: "食品酒水",
        ishaveChild: false,
        children: []
      },
      {
        cate_id: 6,
        cate_name: "食品酒水",
        ishaveChild: false,
        children: []
      },
      {
        cate_id: 7,
        cate_name: "食品酒水",
        ishaveChild: false,
        children: []
      }       
    ],
    curNav: 1,
    curIndex: 0,
    hiddenName: true
  },
  //事件处理函数  
  switchRightTab: function (e) {
    // 获取item项的id，和数组的下标值  
    let id = e.target.dataset.id,
      index = parseInt(e.target.dataset.index);
    // 把点击到的某一项，设为当前index  
    this.setData({
      curNav:id,
      curIndex: index,
      hiddenName: !this.data.hiddenName
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})